﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using C.Entities;
using C.Unite;
using System.Text;

namespace ArtLand.OA.Project
{
    /// <summary>
    /// search 的摘要说明
    /// </summary>
    public class search : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            StringBuilder sb = new StringBuilder();
            List<HR_EMP> empList = TbsDbSession.Default.From<HR_EMP>().Where(HR_EMP._.EMPLID.Contain(context.Request["term"].ToString())).Top(10).ToList();
            if (empList.Count > 0)
            {
                sb.Append("[");

                foreach (HR_EMP item in empList)
                {
                    sb.Append("\"" + item.EMPLID + " - " + item.EMNAME + "\",");
                }
                sb.Remove(sb.Length - 1, 1);
                sb.Append("]");
            }
            context.Response.Write(sb.ToString());
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}